{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "31ef6386",
   "metadata": {},
   "source": [
    "-----------\n",
    "* 日期：2022-11-23 \\week 14(周三）\n",
    "* 课程：python\n",
    "* 记录人：洪梦瑶\n",
    "### 预告：bootstrap\n",
    "-----------\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "2cbbc350",
   "metadata": {},
   "source": [
    "# 1.函数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "f2ff631d",
   "metadata": {},
   "outputs": [],
   "source": [
    "def greet_user():\n",
    "    \"\"\"用户问候语\"\"\"\n",
    "    print(\"hello world~\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "e13578b9",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "hello world~\n"
     ]
    }
   ],
   "source": [
    "greet_user()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "3119d18a",
   "metadata": {},
   "outputs": [],
   "source": [
    "def greet_user(username):\n",
    "    \"\"\"用户问候语\"\"\"\n",
    "    print(\"hello\",username)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "96691121",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "hello 李华\n"
     ]
    }
   ],
   "source": [
    "greet_user(username=\"李华\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "6141f116",
   "metadata": {},
   "source": [
    "# 函数的意义 \n",
    "### 1. 重复使用\n",
    "### 2.可以给了解python的人使用"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "368e8a74",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 实践：广州南方学院新闻网站url实践函数\n",
    "def NFU_NEWS_URL(分类,页码):\n",
    "    \"\"\"广州南方学院新闻页面url数据\n",
    "       分类只需要写对应的编码就可以，对应的页码如下\n",
    "       分类包含：【学校要闻：xxyw，校园动态：xydt，通知公告：tzgg，招投标：ztb】\n",
    "       页码包含：【113，106，37，27】\n",
    "    \"\"\"\n",
    "    for i in range(页码):\n",
    "        print(\"https://www.nfu.edu.cn/\" + 分类 + \"/index\"+str(i)+\".htm\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "e1deb13d",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "https://www.nfu.edu.cn/xydt/index0.htm\n",
      "https://www.nfu.edu.cn/xydt/index1.htm\n",
      "https://www.nfu.edu.cn/xydt/index2.htm\n",
      "https://www.nfu.edu.cn/xydt/index3.htm\n",
      "https://www.nfu.edu.cn/xydt/index4.htm\n",
      "https://www.nfu.edu.cn/xydt/index5.htm\n",
      "https://www.nfu.edu.cn/xydt/index6.htm\n",
      "https://www.nfu.edu.cn/xydt/index7.htm\n",
      "https://www.nfu.edu.cn/xydt/index8.htm\n",
      "https://www.nfu.edu.cn/xydt/index9.htm\n",
      "https://www.nfu.edu.cn/xydt/index10.htm\n",
      "https://www.nfu.edu.cn/xydt/index11.htm\n",
      "https://www.nfu.edu.cn/xydt/index12.htm\n",
      "https://www.nfu.edu.cn/xydt/index13.htm\n",
      "https://www.nfu.edu.cn/xydt/index14.htm\n",
      "https://www.nfu.edu.cn/xydt/index15.htm\n",
      "https://www.nfu.edu.cn/xydt/index16.htm\n",
      "https://www.nfu.edu.cn/xydt/index17.htm\n",
      "https://www.nfu.edu.cn/xydt/index18.htm\n",
      "https://www.nfu.edu.cn/xydt/index19.htm\n",
      "https://www.nfu.edu.cn/xydt/index20.htm\n",
      "https://www.nfu.edu.cn/xydt/index21.htm\n",
      "https://www.nfu.edu.cn/xydt/index22.htm\n",
      "https://www.nfu.edu.cn/xydt/index23.htm\n",
      "https://www.nfu.edu.cn/xydt/index24.htm\n",
      "https://www.nfu.edu.cn/xydt/index25.htm\n",
      "https://www.nfu.edu.cn/xydt/index26.htm\n",
      "https://www.nfu.edu.cn/xydt/index27.htm\n",
      "https://www.nfu.edu.cn/xydt/index28.htm\n",
      "https://www.nfu.edu.cn/xydt/index29.htm\n",
      "https://www.nfu.edu.cn/xydt/index30.htm\n",
      "https://www.nfu.edu.cn/xydt/index31.htm\n",
      "https://www.nfu.edu.cn/xydt/index32.htm\n",
      "https://www.nfu.edu.cn/xydt/index33.htm\n",
      "https://www.nfu.edu.cn/xydt/index34.htm\n",
      "https://www.nfu.edu.cn/xydt/index35.htm\n",
      "https://www.nfu.edu.cn/xydt/index36.htm\n",
      "https://www.nfu.edu.cn/xydt/index37.htm\n",
      "https://www.nfu.edu.cn/xydt/index38.htm\n",
      "https://www.nfu.edu.cn/xydt/index39.htm\n",
      "https://www.nfu.edu.cn/xydt/index40.htm\n",
      "https://www.nfu.edu.cn/xydt/index41.htm\n",
      "https://www.nfu.edu.cn/xydt/index42.htm\n",
      "https://www.nfu.edu.cn/xydt/index43.htm\n",
      "https://www.nfu.edu.cn/xydt/index44.htm\n",
      "https://www.nfu.edu.cn/xydt/index45.htm\n",
      "https://www.nfu.edu.cn/xydt/index46.htm\n",
      "https://www.nfu.edu.cn/xydt/index47.htm\n",
      "https://www.nfu.edu.cn/xydt/index48.htm\n",
      "https://www.nfu.edu.cn/xydt/index49.htm\n",
      "https://www.nfu.edu.cn/xydt/index50.htm\n",
      "https://www.nfu.edu.cn/xydt/index51.htm\n",
      "https://www.nfu.edu.cn/xydt/index52.htm\n",
      "https://www.nfu.edu.cn/xydt/index53.htm\n",
      "https://www.nfu.edu.cn/xydt/index54.htm\n",
      "https://www.nfu.edu.cn/xydt/index55.htm\n",
      "https://www.nfu.edu.cn/xydt/index56.htm\n",
      "https://www.nfu.edu.cn/xydt/index57.htm\n",
      "https://www.nfu.edu.cn/xydt/index58.htm\n",
      "https://www.nfu.edu.cn/xydt/index59.htm\n",
      "https://www.nfu.edu.cn/xydt/index60.htm\n",
      "https://www.nfu.edu.cn/xydt/index61.htm\n",
      "https://www.nfu.edu.cn/xydt/index62.htm\n",
      "https://www.nfu.edu.cn/xydt/index63.htm\n",
      "https://www.nfu.edu.cn/xydt/index64.htm\n",
      "https://www.nfu.edu.cn/xydt/index65.htm\n",
      "https://www.nfu.edu.cn/xydt/index66.htm\n",
      "https://www.nfu.edu.cn/xydt/index67.htm\n",
      "https://www.nfu.edu.cn/xydt/index68.htm\n",
      "https://www.nfu.edu.cn/xydt/index69.htm\n",
      "https://www.nfu.edu.cn/xydt/index70.htm\n",
      "https://www.nfu.edu.cn/xydt/index71.htm\n",
      "https://www.nfu.edu.cn/xydt/index72.htm\n",
      "https://www.nfu.edu.cn/xydt/index73.htm\n",
      "https://www.nfu.edu.cn/xydt/index74.htm\n",
      "https://www.nfu.edu.cn/xydt/index75.htm\n",
      "https://www.nfu.edu.cn/xydt/index76.htm\n",
      "https://www.nfu.edu.cn/xydt/index77.htm\n",
      "https://www.nfu.edu.cn/xydt/index78.htm\n",
      "https://www.nfu.edu.cn/xydt/index79.htm\n",
      "https://www.nfu.edu.cn/xydt/index80.htm\n",
      "https://www.nfu.edu.cn/xydt/index81.htm\n",
      "https://www.nfu.edu.cn/xydt/index82.htm\n",
      "https://www.nfu.edu.cn/xydt/index83.htm\n",
      "https://www.nfu.edu.cn/xydt/index84.htm\n",
      "https://www.nfu.edu.cn/xydt/index85.htm\n",
      "https://www.nfu.edu.cn/xydt/index86.htm\n",
      "https://www.nfu.edu.cn/xydt/index87.htm\n",
      "https://www.nfu.edu.cn/xydt/index88.htm\n",
      "https://www.nfu.edu.cn/xydt/index89.htm\n",
      "https://www.nfu.edu.cn/xydt/index90.htm\n",
      "https://www.nfu.edu.cn/xydt/index91.htm\n",
      "https://www.nfu.edu.cn/xydt/index92.htm\n",
      "https://www.nfu.edu.cn/xydt/index93.htm\n",
      "https://www.nfu.edu.cn/xydt/index94.htm\n",
      "https://www.nfu.edu.cn/xydt/index95.htm\n",
      "https://www.nfu.edu.cn/xydt/index96.htm\n",
      "https://www.nfu.edu.cn/xydt/index97.htm\n",
      "https://www.nfu.edu.cn/xydt/index98.htm\n",
      "https://www.nfu.edu.cn/xydt/index99.htm\n",
      "https://www.nfu.edu.cn/xydt/index100.htm\n",
      "https://www.nfu.edu.cn/xydt/index101.htm\n",
      "https://www.nfu.edu.cn/xydt/index102.htm\n",
      "https://www.nfu.edu.cn/xydt/index103.htm\n",
      "https://www.nfu.edu.cn/xydt/index104.htm\n",
      "https://www.nfu.edu.cn/xydt/index105.htm\n"
     ]
    }
   ],
   "source": [
    "NFU_NEWS_URL(\"xydt\",106)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "39ad7fbc",
   "metadata": {},
   "source": [
    "# 2.模块"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "6a84a36d",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
